import Vue from 'vue'
import Router from 'vue-router'

const home = () => import('../views/home_page/home_page')
const iphomes = () => import('../views/iphomes_page/iphomes_page')
const iphomesDetails = () => import('../base/details-box/details-box')
const register = () => import('../base/register-box/register-box')
const login = () => import('../base/login-box/login-box')
const update = () => import('../base/update-box-img/update-box-img')
const loginDetails = () => import('../base/login-details/login-details')
const intelligentdevices = () => import('../views/intelligentdevices_page/intelligentdevices')
const gamedevices = () => import('../views/gamedevices_page/gamedevices')
const electronics = () => import('../views/electronics_page/electronics')
const poweraccessories = () => import('../views/poweraccessories_page/poweraccessories')
const mobilestorages = () => import('../views/mobilestorages_page/mobilestorages')
const circums = () => import('../views/circums_page/circums')

Vue.use(Router)

const router = new Router({
   mode: 'history',
   routes: [
      {
         path: '/',
         redirect: '/home'
      },
      {
         path: '/home',
         name: 'home',
         component: home
      },
      {
         path: '/iphomes',
         name: 'iphomes',
         component: iphomes
      },
      {
         path: '/intelligentdevices',
         name: 'intelligentdevices',
         component: intelligentdevices
      },
      {
         path: '/gamedevices',
         name: 'gamedevices',
         component: gamedevices
      },
      {
         path: '/electronics',
         name: 'electronics',
         component: electronics
      },
      {
         path: '/poweraccessories',
         name: 'poweraccessories',
         component: poweraccessories
      },
      {
         path: '/mobilestorages',
         name: 'mobilestorages',
         component: mobilestorages
      },
      {
         path: '/circums',
         name: 'circums',
         component: circums
      },
      {
         path: '/iphones/:id',
         name: 'iphomesDetails',
         component: iphomesDetails
      },
      {
         path: '/register',
         name: 'register',
         component: register
      },
      {
         path: '/login',
         name: 'login',
         component: login
      },
      {
         path: '/update',
         name: 'update',
         component: update
      },
      {
         path: '/loginDetails',
         name: 'loginDetails',
         component: loginDetails
      }
   ],
   scrollBehavior(to, from, savedPosition) {
      return {x:0, y:0}
   }
})

export default router
